WinCmd Help Index

How To use

WinCmd internal commands

Batch commands

Command line syntax

Aliases

Repeating the command line

Drag and Drop

Running external commands

Starting of associated documents

Using environment variables

Copyright

Commands

File menu

Command menu

Options menu

Window menu

Help menu


File menu commands

The File menu offers the following commands:

New	Creates a new document.
Close	Closes an opened document.
Exit	Exits WinCmd.


Command menu commands

This menu consists of up to 20 items. Every item is associated with a pop up menu that consists of up to 20 items. Every item of these items can associate with a program, internal command or a batch or cmd file to run or a document file to load or to print.

This menu is organized in the INI file (CMD.INI, which you can find in the windows directory). This means that the items of this menu can be changed by you. Also the program to run or document to load or to print can be changed to fit your need. Please read this topic to see how it functions.

Each level of the menu has a section in CMD.INI where is this managed. The top level pop up menu Command is described in the section  [Command Menu], for example:

[CommandMenu]

PopupItems=5

PopupItem1=&Maingroup1

PopupItem2=&Accesories

PopupItem3=SEPARATOR

PopupItem4=MS-&Tools

PopupItem5=&Tools

The first line in this section sets the number of the top level pop up items (5). All the names on the left side of the equal sign are not optional and must be used as they are. The names on the right side are Optional and can be changed to fit your needs. The & character means that the character after it will be underlined to choose it with Alt-key. SEPARATOR means that a horizontal line will be drawn in this position on the menu to separate items. Every item of these items should be described in a separate section. For example the first pop up item has the following submenu.

[PopupItem1]

menuitems=4

menuItem1=&File Manager

menuItem2=&Ms-Dos

menuItem3=SEPARATOR

menuItem4=&Clip Board

[PopupItem2]

menuItems=4

menuItem1=&Clock

menuItem2=C&alculator

menuItem3=Ca&lendar

menuItem4=Cha&racter Map

Also in this Menu all names on the left side of the equal sign are not optional, on the right side are Optional and you may write them to fit your needs.

You may try to make some changes to see how it works. Please make a copy of the original CMD.INI file before you try something.

What would be done when you choose one of these menu items is described in the section  [Files].

First you have to know how to choose the names on the left side of the equal sign. These names consist of the word  file  and a number that define the menu location in the menu structure. You can calculate this number from the following equation:

file number = (Top level pop up item number - 1) * 20 + menu item number

For example the command associated with the third item of the second top level menu would be

file number = (2 - 1) * 20 + 3 = 23

the command line would be

file23=c:\windows\calendar.exe

Please notice that white spaces are not allowed as a part of the left side of the expression but you can use white spaces to separate the command line parameters. For example:

file2=notepad.exe doc1.txt

Here is the  Files  section related to the above described menus.

[Files]

file1=c:\windows\winfile.exe

file2=c:\windows\dosprmpt.pif

file4=c:\windows\clipbrd.exe

file21=c:\windows\clock.exe

file22=c:\windows\calc.exe

file23=c:\windows\calendar.exe

file24=c:\windows\charmap.exe

For more examples see also  CMD.INI  (normally in windows directory).


Options menu commands

The View menu offers the following commands:

Toolbar	Shows or hides the toolbar.
Status Bar	Shows or hides the status bar.
Text Color	Changes the text color.
Defaults	Changes or  shows the start defaults of WinCmd.


Window menu commands

The Window menu offers the following commands, which enable you to arrange multiple views of multiple documents in the application window:

Cascade	Arranges windows in an overlapped fashion.
Tile	Arranges windows in non-overlapped tiles.
Arrange Icons	Arranges icons of closed windows.
Window 1, 2, ...	Goes to specified window.


Help menu commands

The Help menu offers the following commands, which provide you assistance with this application:

Index	Offers you an index to topics on which you can get help.
Using Help	Provides general instructions on using help.
About	Displays the version number of this application.


File New command
New command (File menu)

Use this command to create a new command window. Normally you need only one window. In some cases you may need more than one command window. For example when you need to check a list of files in one window, so you can write some of them in the other window to run a certain command (for example when you copying files). Every command window can have a drive as a default drive. The active window will always find the active directory of this drive and prompt it. On one Drive can only one directory the active directory. For example when you choose two directories of the same drive in two windows it means you have only one current directory (the directory in the active window). In this case when you make the other window active, it becomes also the current file.

Shortcuts

Toolbar:

Keys:	CTRL+N


File Close command
Close command (File menu)

Use this command to close the active window.

You can also close the active window by using Close on the control menu button of the active WinCmd window or double click it, as shown below:

Shortcuts

Mouse:	Choose Close on the control menu button or

Double-click the window's Control menu button.

Keys:	CTRL+F4


File Exit command
Exit command (File menu)

Use this command to end your WinCmd session.  You can also use the Close command on the application Control menu button or double click it.

Shortcuts

Mouse:	Choose Close on the application control menu or

Double-click the application's Control menu button.

Keys:	ALT+F4


View Toolbar command
Toolbar command (Options menu)

Use this command to display and hide the Toolbar, which includes buttons for some of the most common commands in WinCmd.  A check mark appears next to the menu item when the Toolbar is displayed.

See Toolbar for help on using the toolbar.


Toolbar

The toolbar is displayed across the top of the application window, below the menu bar.  The toolbar provides quick mouse access to many tools used in WinCmd.

To hide or display the Toolbar, choose Toolbar from the Options menu (ALT, V, T).

Click	To

Open a new document.

Display program and system information.

Display help for clicked on buttons, menus and windows.


View Status Bar Command
Status Bar command (Options menu)

Use this command to display and hide the Status Bar, which describes the action to be executed by the selected menu item or depressed toolbar button, and keyboard latch state. A check mark appears next to the menu item when the Status Bar is displayed.

See Status Bar for help on using the status bar.


Status Bar

The status bar is displayed at the bottom of the WinCmd window.  To display or hide the status bar, use the Status Bar command in the Options menu.

The left area of the status bar describes actions of menu items as you use the arrow keys to navigate through menus.  This area similarly shows messages that describe the actions of toolbar buttons as you depress them, before releasing them.  If after viewing the description of the toolbar button command you wish not to execute the command, then release the mouse button while the pointer is off the toolbar button.

The right areas of the status bar indicate which of the following keys are latched down:

Indicator	Description

CAP	The Caps Lock key is latched down.

NUM	The Num Lock key is latched down.

SCRL	The Scroll Lock key is latched down.


Text Color
Text Color command (Options menu)

This option is used to change the text color of WinCmd. When you activate this function, a color dialog box will be then displayed. Choose the color you want from this box. The displayed color in the active window will be then changed to this color.


Start options
Defaults command (Options menu)

This Option is used to set a few start options, which loaded automatically from the file  CMD.INI  when the WinCmd loaded.

Pass DOS environment

Load AUTOEXEC.CMD when found

Load Aliases from ALIAS.INI

Write Aliases back to ALIAS.INI

Accept dropped files as a part of commands

Print not associated ascii-files as NOTEPAD documents

Start server program when tries to start document

Treat batch-files as cmd-files (Do not load command.com to run them)

Max. number of lines to scroll within


Dos environment
Pass DOS environment

Mark this option if you want that the DOS environment passed to WinCmd. The default if this option is on (DOS environment will be passed).

An example of DOS environment is:

CONFIG=no_ems

COMSPEC=C:\DOS\COMMAND.COM

BLASTER=A220 I7 D1 T2

SOUND=C:\SGBXII

PROMPT=$p$g

PATH=D:\WINWORD;C:\DOS;C:\WINDOWS;D:\TOOLS\DOS;D:\MSVC\BIN;

TEMP=C:\TEMP

INCLUDE=d:\msvc\include;d:\msvc\mfc\include;d:\prog\posix\h;

LIB=d:\msvc\lib;d:\msvc\mfc\lib;

windir=C:\WINDOWS

Some of these environment variables have no effect in windows session for example  CONFIG or SOUND. Other variables are important for example PATH. In WinCmd, you can execute external programs, that means you need the variable path. Perhaps you need to change, delete or to put  some directories to it to fit your needs in windows.

Of course you can change the value of these variables after you start WinCmd or you can put your changes in AUTOEXEC.CMD. In This case you have to mark the option Load AUTOEXEC.CMD when found.


Load autoexec.cmd
Load AUTOEXEC.CMD when found

Mark this option if you want that the file  AUTOEXEC.CMD  automatically loaded when you start WinCmd. The file AUTOEXEC.CMD must be in the same directory as  WINCMD.EXE. In this file you may put or change environment variables, if you put the option Pass DOS environment  is marked. You can also start a program or run an internal command or Start a document


Load Aliases from ALIAS.INI

Aliases can be defined and used in WinCmd at any time. Sometimes you need alias names once and you do not need them any more. Mostly you have some aliases that fit your need and you need them to be loaded. These aliases would be written to ALIAS.INI if the option  Write alias back to ALIAS.INI active and used in every session. Mark this option, to load the defined aliases in ALIAS.INI. The file ALIAS.INI must be in the same Directory as WINCMD.EXE.


Write aliases back
Write Aliases back to ALIAS.INI

Mark this Option if you want that all aliases defined in one session written back to the file ALIAS.INI, so that you can use them every time you start WinCmd. If you do not want that your defined aliases written back to ALIAS.INI, deactivate this option. You may also write your standard aliases per hand in ALIAS.INI.


Accept dropped files
Accept dropped files as a part of commands

If you want that the dropped files from file manager accepted in WinCmd as a part of the command line, mark this option. If you mark or unmark this option you have to restart WinCmd to affect this option.


Print non associated ascii files
Print not associated ascii-files as NOTEPAD documents

If this Option is active, you will be able to print the not associated ascii-files as a NOTEPAD document. To associate a document file type with a program use the file manager  Associate in the file menu (normally you do not need to do that because the most programs register their file types automatically). If you want to print a document that not associated with a program, WinCmd try to print it as an ASCII-file (only if it a text file and this option active).


Running associated document files
Start server program when tries to start document

In WinCmd you can execute a program, batch file or cmd file (WinCmd batch identical file) by typing is name. You can also run a program that associated with a certain document type by typing the name of the document (the same as double click a document file in file manager). Mark this option to be able to start an associated file, or unmark it if you do not want to do that. If this option unmarked, you will be able to run .EXE, .COM, .BAT, and .CMD files only.


Running batch files
Treat batch-files as cmd-files

Mark this option if you want that WinCmd loads and runs batch files. Such batch files will be run by loading command.com first (if this option deactivated), which loads and runs the batch file. Cmd files and batch files are not identical. Mostly it is not reasonable to do that, for example if you call some other DOS programs such xcopy, format.


Max. number of lines
Max. number of lines to scroll within (20 - 1000)

The maximum number of lines, is the number of lines that should be saved in the window buffer, so that you can scroll within them to control the output. If the lines of output bigger than the number of lines should be saved, you will not be able to control the first few lines of the output. I have made a condition here, so that you can but numbers between 20 and 1000. A reasonable number of lines would be between 50 and 200. This would be enough for most cases depending on you specific needs. You may begin with 100 lines and then you can see if it enough. After you have changed this option you should restart WinCmd before the changes takes place.


Cascade
Cascade command (Window menu)

Use this command to arrange multiple opened windows in an overlapped fashion.


Tile
Tile command (Window menu)

Use this command to arrange multiple opened windows in a non-overlapped fashion.


Arrange icons
Window Arrange Icons Command

Use this command to arrange the icons for minimized windows at the bottom of the main window.  If there is an open document window at the bottom of the main window, then some or all of the icons may not be visible because they will be underneath this document window.


1, 2, , ...
1, 2, ... command (Window menu)

WinCmd displays a list of currently open windows at the bottom of the Window menu.  A check mark appears in front of the active window.  Choose a window from this list to make it active.


Index
Index command (Help menu)

Use this command to display the opening screen of Help.  From the opening screen, you can jump to step-by-step instructions for using WinCmd and various types of reference information.

Once you open Help, you can click the Contents button whenever you want to return to the opening screen.


Help using
Using Help command (Help menu)

Use this command for instructions about using Help.


About
About command (Help menu)

Use this command to display the copyright notice and version number of your copy of WinCmd and the system information (memory and system resources).


Context help
Context Help command

Use the Context Help command to obtain help on some portion of WinCmd.  When you choose the Toolbar's Context Help button, the mouse pointer will change to an arrow and question mark.  Then click somewhere in the WinCmd window, such as another Toolbar button.  The Help topic will be shown for the item you clicked.

Shortcut

Keys:	SHIFT+F1


Title Bar

The title bar is located along the top of a window.  It contains the name of the application and document.

To move the window, drag the title bar.  Note: You can also move dialog boxes by dragging their title bars.

A title bar may contain the following elements:

Application Control-menu button

Document Control-menu button

Maximize button

Minimize button

Restore button


Scroll bars

Displayed at the right and bottom edges of the window.  The scroll boxes inside the scroll bars indicate your vertical and horizontal location in the window.  You can use the mouse to scroll to other parts of the window.

Up to 100 lines will displayed in WinCmd window. If the output more than 100 lines, then the first line will be truncated. You can only scroll these 100 lines. The scroll page size is equal to ¾ of the windows height and ¾ of the windows width.


Size command
Size command (System menu)

Use this command to display a four-headed arrow so you can size the active window with the arrow keys.

After the pointer changes to the four-headed arrow:

1.	Press one of the DIRECTION keys (left, right, up, or down arrow key) to move the pointer to the border you want to move.

2.	Press a DIRECTION key to move the border.

3.	Press ENTER when the window is the size you want.

Note:  This command is unavailable if you maximize the window.

Shortcut

Mouse:	Drag the size bars at the corners or edges of the window.


Move command
Move command (Control menu)

Use this command to display a four-headed arrow so you can move the active window or dialog box with the arrow keys.

Note:  This command is unavailable if you maximize the window.

Shortcut

Keys:	CTRL+F7


Minimize Command
Minimize command (application Control menu)

Use this command to reduce the WinCmd window to an icon.

Shortcut

Mouse:	Click the minimize icon [image] on the title bar.

Keys:	ALT+F9


Maximize command
Maximize command (System menu)

Use this command to enlarge the active window to fill the available space.

Shortcut

Mouse:	Click the maximize icon [image] on the title bar; or double-click the title bar.

Keys:	CTRL+F10 enlarges a document window.


Next window command
Next Window command (document Control menu)

Use this command to switch to the next open document window.  WinCmd determines which window is next according to the order in which you opened the windows.

Shortcut

Keys:	CTRL+F6


Previous command
Previous Window command (document Control menu)

Use this command to switch to the previous open document window.  WinCmd determines which window is previous according to the order in which you opened the windows.

Shortcut

Keys:	SHIFT+CTRL+F6


Close command
Close command (Control menus)

Use this command to close the active window or dialog box.

Double-clicking a Control-menu box is the same as choosing the Close command.

Note:  If you have multiple windows open for a single document, the Close command on the document Control menu closes only one window at a time.  You can close all windows at once with the Close command on the File menu.

Shortcuts

Keys: 	CTRL+F4 closes a document window

ALT+F4 closes the WinCmd window or dialog box


Restore command
Restore command (Control menu)

Use this command to return the active window to its size and position before you chose the Maximize or Minimize command.


Switch To command
Switch to command (application Control menu)

Use this command to display a list of all open applications.  Use this "Task List" to switch to or close an application on the list.

Shortcut

Keys:	CTRL+ESC

Dialog Box Options

When you choose the Switch To command, you will be presented with a dialog box with the following options:

Task List

Select the application you want to switch to or close.

Switch To

Makes the selected application active.

End Task

Closes the selected application.

Cancel

Closes the Task List box.

Cascade

Arranges open applications so they overlap and you can see each title bar.  This option does not affect applications reduced to icons.

Tile

Arranges open applications into windows that do not overlap.  This option does not affect applications reduced to icons.

Arrange Icons

Arranges the icons of all minimized applications across the bottom of the screen.


How to use WinCmd

Commands

WinCmd internal commands

Batch commands

Command line syntax

Aliases

Repeating the command line

Drag and Drop

Running external commands

Starting of associated documents	Using environment variables.


Internal commands
WinCmd internal commands

ALIAS	ATTRIB

BEEP	CD, CHDIR

Change drive	COPY

DATE	DELETE, DEL, ERASE

DELTREE	DIR

ECHO	EXITWIN

GET	GETFILE

LISTBOX	MD, MKDIR

MOVE	MSGBOX

PATH	PLAY

PRINT	REN, RENAME

RD, RMDIR	SET

TIME	TYPE

See also:

Batch commands

Command line syntax

Aliases

Repeating the command line

Drag and Drop

Running external commands

Starting of associated documents

Using environment variables.


DIR

The Command DIR is used to list a list of files or the contents of a directory.

Syntax:

DIR [file name | directory name] [/A] [/W | /B | /F | /D]

Arguments:

file name | directory name : 	the name of the file(s) or directory you want to list. You can also use the wild cards  *  and/or  ? .If you omit this argument a list of the current directory displayed.

Standard options:

/A	Lists all files and directories even the hidden and system files.

/W	Wide format. It displays only the names of files and directories more columns according to the width of the window.

/B	Lists only the names of files and directories in one column.

WinCmd options:

/F	Lists only files in one column. This output format is suitable for

listbox.

/D	Lists only directories as a column. This output format is suitable for

listbox.

Examples:

Command	To

dir /w	list the current directory in wide format (more columns).dir *.cmd list the files that have the extension cmd.

dir /f	list only the files in the current directory, directories will not be listed.

dir a:	lists the current directory of the drive a:

Notes:

- You can redirect the output of this command to make a list file to use with other commands. For example use  dir /d > dir.lst   to list the subdirectories of the current directory. The output will be written to   dir.lst .

- You can also redirect the output of dir to  nul  when you need to check for example if a directory exists. You can then check the errorlevel via if. Another method to do that is the command test.

rem testing if a subdirectory subdir1  exists

dir /d subdir1 > nul

i errorlevel 1 echo "Directory subdir1 not exists"

- The command dir returns 0 if there is no error and 1 if an error occurs for example because the file/directory you want to display not exists.


CD
CD or CHDIR

CD or CHDIR used to change the current directory to another directory of the same drive or other drive, to show the current directory or to show the current directory of any drive.

Syntax:

CD [directory name | drive name]	or

CHDIR [directory name | drive name]

Arguments:

directory name | drive name :	The name of the directory or path to a directory (of the same drive or other drive) to which you want to change. If you use  cd  with drive name, the current directory of this device will be displayed. If you use it without arguments, the current directory will be displayed.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

cd 	show the current directory.

cd a:	show the current directory of drive a: .

cd \	change the directory to root directory of the current drive.

cd ..	change to the parent directory of the current directory.

cd d:\temp	change to the current directory of drive d: to temp (The current drive will not be changed).

cd te*	change to the directory that is name begins with  te .

Notes:

- As you can see from the last example above, you can use wild cards to define the directory that you want to change to. If there is two directories that have the same non wild character, cd will change to the first of them (disk position, or in the dir list). For example if you have two directories   temp  and  text,  cd  te*  will change to the directory that comes first in the dir list. May be it looks nonsense to support wild cards, but you can see for such directories like windows, is easier to write  cd  w*  than to write  cd  windows.

- The command cd returns 0 if there is no error and 1 if an error occurs for example if the directory you want to change to not exists. You can check it in cmd files (batch files) via errorlevel


Change drive

This command is used to change the current drive to another valid drive.

Syntax:

<Drive character>:

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

Command	To

a:	change the current drive to drive  a

d:	change the current drive to drive  d

Notes:

- You can also change the drive to a network drive if you are logged on.

- The command returns 0 if there is no error and 1 if an error occurs for example if the drive not exists. You can check this error in cmd files (batch files) via errorlevel


MD
MD or MKDIR

MD or MKDIR is used to make a new subdirectory.

Syntax:

MD [path name]	or

MKDIR [path name]

Arguments:

path name :	the path of the directory you want to make. You may use absolute or relative path

Standard options:

non

WinCmd options:

non

Examples:

Command	To

md  cmd	make the subdirectory  cmd  of the current directory

md ..\xxx	make the subdirectory  xxx  of the parent directory of the current directory

md a:\temp 	make the subdirectory  of the root directory of drive a:

Notes:

- Wild cards are not allowed.

- The command md returns 0 if there is no error and 1 if an error occurs for example if the directory or a file of the same name exists. You can check it in cmd files (batch files) via errorlevel.


RD
RD or RMDIR

RD or RMDIR is used to delete an existing subdirectory.

Syntax:

RD [path name]	or

RMDIR [path name]

Arguments:

path name :	the path of the directory you want to delete. You may use absolute or relative path

Standard options:

non

WinCmd options:

non

Examples:

Command	To

rd  cmd	delete the subdirectory  cmd  of the current directory

rd ..\xxx	delete the subdirectory  xxx  of the parent directory of the current directory

rd a:\temp	delete the subdirectory  of the root directory of drive a:

Notes:

- Wild cards are not allowed.

- The directory you want to delete must exists and empty.

- The command md returns 0 if there is no error and 1 if an error occurs for example if the directory you want to delete not exists or not empty. You can check the error  in cmd files (batch files) via errorlevel.


PATH

PATH is used to display the path in which to search for executable, batch or cd files, edit (change) it or to define a new one. Unlike DOS the current path will be displayed in a dialog box. After you make the changes you want click the Ok button or press return, the new path will be saved in the environment variable path.

Syntax:

PATH

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

Command	To

path	to display the current path, to edit it or to define a new one.

Notes:

- The changes you make to the search path will only affect WinCmd (the super environment block will not be changed). That means if you run any other DOS-program the transferred path would be the DOS defined path not the path you change in WinCmd.

- If you want to change the path without editing it in a dialog box, you may use set. See also AUTOEXEC.CMD.

- The command path returns 0 if the path can be changed, and 1 if the path not changed for example if you clicked on Cancel button of the dialog box. The returned value can be checked in cmd files (batch files) via errorlevel.


DELTREE

DELTREE is used to delete a directory tree (a directory and it subdirectories and files). Please be careful when you use this command. If you delete a directory that you did not want to delete please use any undelete program that can undelete directories (Microsoft undelete for windows©	 or PCTOOLS ©).

Syntax:

DELTREE <path name>

Arguments:

path name	The path of the directory you want to delete it and all its subdirectories and files.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

deltree temp	delete the directory tree  temp

deltree a:\xxx	delete the directory xxx on drive a: and all its subdirectories and files

deltree *.*	delete all files and subdirectories of the current directory. Please remember if you do this in the root directory of a disk, the whole disk will be deleted.

Notes:

- You can use wild cards with deltree. Please remember you will delete all files and subdirectories.

- If you use deltree with wild cards, a message box will show you the directory that will be delete and asking you to confirm it. When the subdirectories of this directory deleted, you will not be asked any more to confirm it.

- Files will be deleted without asking you to confirm.

- Write protected, system and hidden files and subdirectories will not be deleted.

- The command deltree returns 0 if the directory can be deleted and 1 if the path not found or can not be deleted. If all the files and directories can be deleted deltree will return 2. The returned value can be checked in cmd files (batch files) via errorlevel.

- Please use delete to delete files instead of deltree.


ATTRIB

ATTRIB is used to display and change the attributes of files and directories.

Syntax:

ATTRIB [-a|+a] [-r|+r] [-s|+s] [-h|+h]  [[path name1] [path name2] ...] [/s]

Arguments:

path name:	The name of the file(s) or directory(s) to display or change the attributes.

Standard options:

-a	delete the archive flag

+a	put the archive flag

-r	delete the read only flag

+r	put the read only flag

-s	delete the system flag

+s	put the system flag

-h	put the hidden flag

+h	put the hidden flag

/s	display or change the attributes of all files and subdirectories.

WinCmd options:

non

Examples:

Command	To

attrib -a +s  xxx 	delete the archive attribute and put the system attribute for this file or directory name's xxx. If xxx is a directory, only the attribute of this directory but not its contents will be changed.

attrib +r temp /s	put the read only flag for the  directory temp and  all its files and subdirectories

attrib +r temp\*.*	put the read only flag for the contents of the directory temp (files and directories but not the contents of the subdirectories). The attributes for temp will also not be changed.

attrib +s +r *.sys *.com *.exe	put the read only an system attributes for all the files that have the extension  sys, com  or exe

Notes:

- Wild card can be used. See the example above.

- You can use attrib to change or display attributes for more than one file (directory) and(or file or directory mask). See the last example above.

- The command attrib returns 0 if the attributes can be changed or displayed and 1 if it is not possible for example when the named file(s) or directory(s) not exists. The return value can be checked in batch files or cmd files via errorlevel.

- Files and directories that have read only, system or hidden attributes can not be changed until this attributes deleted. For more information see delete, rd  and deltree.


DEL
DEL, DELETE or ERASE

This command is used to delete file(s).

Syntax:

DEL  [file group1] [file group2] [....]	or

DELETE  [file group1] [file group2] [....]	or

ERASE  [file group1] [file group2] [....]

Arguments:

file group1   file group2  ....	are the files you want to delete. You can also use wild cards in each argument. You may use up to 10 file groups.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

del  c:\dos\*.tmp  d:\temp\*.tmp	delete the files those extensions are tmp in the directories c:\dos and d:\temp.

del  *.bat  *.exe  *.com	delete the files those extensions are  bat,  exe and  com in the current directory.

del  .	delete all the files in the current directory.

del  ..	delete all the files in the parent directory

del  temp	delete the file temp, if temp is a directory, all its files would be deleted.

Notes:

- DEL will delete only files but not directories. See also rd and deltree.

- You can delete files in more than on directory or drive (see the examples above).

- You can use in every file group the relative path or the absolute path to the files you want to delete.

- The command del returns 0 if the files can be deleted and 1 if it is not possible to do that for example when the named file(s) does not exist. The return value can be checked in batch files or cmd files via errorlevel.


REN
REN or RENAME

REN is used to rename an existing file or directory.

Syntax:

REN <old file name | directory name> <new file name | directory name>	or

RENAME <old file name | directory name > <new file name | directory name >

Arguments:

old file name | directory name:	the old name of the file or directory you want to rename.

new file name | directory name:	the new name of the file or directory.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

ren doc1.old doc1.new	rename the file doc1.old. The new name of this file is doc1.new.

ren tmp temp	rename the directory tmp to temp.

Notes:

- Wild cards are not allowed (I do not implement the wild cards because I mean it is nonsense).

- Please use move to move files to another directory.

- Unlike DOS you can use REN to rename directories.

- The command rename returns 0 if the file or directory can be renamed and 1 if it is not possible to do that for example when the file/directory does not exist. The return value can be checked in batch files or cmd files via errorlevel.


MOVE

MOVE is used to rename files, move files from a directory to another directory or to rename  directories.

Syntax:

To rename a file:

MOVE <source file> <destination file>

Arguments:

source file	the name of the file you want to rename.

destination file	the new name of the file.

As rename you can not use wild cards.

or Syntax:

To rename a directory:

MOVE <source directory> <destination directory>

Arguments:

source directory	the name of the directory you want to rename.

destination directory	the new name of the directory.

You can not also use wild card with this syntax. Please note that you can not move directories but you can rename then; that means that moving directories from a path to another is not possible.

or Syntax:

To  move files to another directory:

MOVE <source files1> [source files2] [.....] <destination directory>

Arguments:

source files1  source files2 ...	the names of the source files you want to move.

destination directory	the name of the directory you want that files to move to.

You may use wild cards as a part of the source file names. You can move up to 8 file groups to the destination directory.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

move file.old file.new	rename file.old to file.new.

move dir1 dir2	rename the directory dir1 to dir2.

move *.cpp *.h *.rc *.hlp *.exe dir1	move the files with the extension  cpp, h, hlp and exe from the current directory to the directory dir1. Please remember  dir1 must be in the same file system as the files.

move \prog\*.c \inc\*.h \prog1	move the files with the extension  c  from the directory prog and the files with the extension  h  from the directory inc to the directory prog1.

Notes:

- Move means internally changing a record in the file allocation table. It is not possible to move files or directories from a file system (disk) to another file system. In such case you may copy the files and then delete the original files.

- If the destination file(s) or directory exists, move will not be able to overwrite them.

- The command move returns 0 if the files or directories can be moved and 1 if it is not possible to do that. For example when the source file(s)/directory does not exist or the destination file/directory exists. The return value can be checked in batch files or cmd files via errorlevel.

- Read only can be moved, system and hidden files can not be moved.

- The main directory (ROOT) can not be moved.


COPY

COPY is used to copy file to another or copy files to another directory.

Syntax:

COPY <source file1> <destination file>

or

COPY <source files1> [source files2] [....] <destination directory>

or

COPY <directory1> [directory2] [....] <destination directory>

Arguments:

source file 	the source file you want to copy.

destination file	the destination file.

source files1  source files 2 ...	the source files you want to copy. You may copy up to 8 file groups.

destination directory	the directory to which the files copied to.

directory1 directory2 ...	the directory(s), that it's (their) contents should be copied.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

copy doc1.doc doc1.old	copy doc1.doc to doc1.old.

copy abc.exe a:	copy abc.exe from the current directory to the current directory of drive a: .

copy  inc\*.h  prog\*.c d:\prog1	copy the files with the extension  h  from the directory inc and the files with the extension  c  from the directory prog to the directory  prog1 on d: .

copy  d:*.*  .	copy all the files of the current directory of drive d: to the current directory.

copy d:. .	copy all the contents of the current directory of the drive d: to the current directory.

copy d:\dir1 a:\dir2 .	copy the contents of the directories dir1 (drive d:) and dir2 (drive a:) to the current directory.

Notes:

- If the destination file(s) exists, copy will overwrite them.

- The command copy returns 0 if the file(s) copied and 1 if it is not possible to do that for example when the source file(s) does not exist or the destination directory does not exist. The return value can be checked in batch files or cmd files via errorlevel.

- Read only can be copied, system and hidden files can not be copied.

- Unlike DOS the destination directory can not be omitted. If you want to copy file(s) to the current directory, you may use  .  "period" to indicate it.


TYPE

TYPE is used to display the contents of an ASCII file(s).

Syntax:

TYPE  <file group1> [file group2] [...]  /f

Arguments:

<file group1> [file group2] [....]	the name of the file or files you want to display. Wide cards can be used. Up to 9 file groups can be used.

Standard options:

non

WinCmd options:

/f	type will write a header and a footer containing the name of the file at the beginning and end of each file.

Examples:

type *.bat \prog\*.h readme.txt	display the contents of the files with the extension  bat  in the current directory, the files with the extension  h  in prog and the file readme.txt.

type *.bat > bat.all	type the contents of the files with the extension  bat in the current directory. The output will not be displayed but written in to the file bat.all. This is how to concatenate ASCII files.

type last.txt >> first.txt	concatenate the content of the file last.txt to the file first.txt .

Notes:

- You can use type to concatenate files. See examples above. Normally you do not need to use the option  /f  in such case unless you want the header and footer lines to be written to the output file.

- The command type returns 0 if the file(s) if there is no error and 1 if an error occurred for example when the file(s) to be typed does not exists or can not be opened. The return value can be checked in batch files or cmd files via errorlevel.


EXITWIN

EXITWIN is used to end the windows session.

Syntax:

EXITWIN

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

exitwin

Notes:

- Before WinCmd ends the windows session, it will check the function File/Exit for every running program to see if there is something to do (for example if there is any unsaved data). In this case the program will be activated, and you will be asked to save the unsaved data.


TIME

TIME is used to display the time.

Syntax:

TIME

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

time

Notes:

- Unlike DOS, you will not be able to change the time.

- To change the time if it not correct for example, use the  Date/Time in control panel.

- Use the command date to display the date.


DATE

DATE is used to display the date.

Syntax:

DATE

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

date

Notes:

- Unlike DOS, you will not be able to change the date.

- To change the date if it not correct for example, use the  Date/Time in control panel.

- Use time to display the time.


PLAY

PLAY is used to play wave file(s).

Syntax:

PLAY <file name(s)>

Arguments:

file name(s)	The name of the file or files you want to play. You may also use wild cards.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

play c:\windows\*.wav	play all the wave file in windows directory.

Notes:

- If you do not have installed any wave driver, the command play will not be able to play any wave files. In this case play will display a message box to indicate that. Install a wave driver suitable to your hardware and try again.

- To install a wave driver choose driver in the data panel and follow the instructions. For more information about installing drivers see also in your Windows© hand book or data panel online help.


MSGBOX

MSGBOX is used to display a message box.

Syntax:

MSGBOX  <Message> [Button(s)] [Icon]

Arguments:

Message	The message you want to display (Must be quoted).

Standard options:

non

WinCmd options:

Button(s)	The buttons you want to display. It can be non or one of the following:

Ok	Only one button with the caption  Ok (default).

yesno	Two buttons with the caption Yes and No .

yesnocancel	Three buttons with the caption Yes, No and Cancel.

Icon	The icon type you want to display. It can be non or one of the following:

stop	Stop icon

Question	Question icon

info	Info icon (default)

Examples:

Command	To

msgbox "Hello WinCmd World"	Display a message box with the message "Hello WinCmd World", one button (Ok) and  Info  icon.

Notes:

- If you omit the option button, the default button (Ok) will be used.

- If you omit the option icon, the default icon (Info) will be displayed.

- The command  msgbox  returns a value depending upon the button clicked. If you click the Ok button or the  Yes  button, it returns 1. If you click the  No  button it returns 2 and if you click the  Cancel  or if you choose Close in the system menu of the message box it returns 0. This value can be checked via errorlevel to proof which button was clicked.

Example:

rem  newdel.cmd

if not args 2 echo "Usage : %0 <file name>";exit

test %1 /f

if not errorlevel 0 msgbox "File %1 not found";exit

msgbox "Do you want really to delete %1" yesnocancel question

if errorlevel 1 del %1


BEEP

BEEP is used to force a beep tone or to play the wave form file associated with the default sound.

Syntax:

BEEP

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

beep

Notes:

- You can change the sound associated with this command by changing the sound associated with the default sound in control panel/ Sound.

- You may use the command beep combined with if to indicate some error.

Example:

rem newtype.cmd

if not args 2 beep;echo "Usage : %0 <file name>";exit

test %1 /f

if errorlevel 1 beep;msgbox "%1 not found" stop;exit

type %1 /f


ECHO

ECHO is used to echo a message. The message must be quoted.

Syntax:

ECHO  [Message]

Arguments:

Message	The message to display. The message should be quoted to prevent parsing it. If you omit this argument an empty line will be displayed.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

echo  "An echo test!!!"	display the message  "An echo test" .

echo	display an empty line.

Notes:

- Unlike DOS the message of echo must be quoted otherwise it will not be handled correct.

- echo on/off are not supported.

- You may use echo without arguments in your cmd files to make the output readable, by putting empty lines between the output lines.


SET

SET is used to set or delete an environment variable or to display all the environment variables.

Syntax:

SET  [variable name=[string]]

Arguments:

Variable name	The name of the variable to be set or delete.

String 	The value of the variable to be set.

If you omit the argument, a list of all environment variables will be displayed. If you omit  the "String", the variable will be deleted.

I

Standard options:

non

WinCmd options:

non

Examples:

Command	To

set	displays all the environment variables.

set  path=	delete the environment variable "path".

set "path=c:\windows;c:\dos"	set the path to "c:\windows;c:\dos". You can also use the command path to set or change the path. The " " are important so that the ; not implemented as separator between two commands. For more information about see also command line syntax.

set "path=%path%;d:\winword"	extend the path with  "d:\winword".

set home=c:\prog\c	set the variable home to  c:\prog\c . You may use home then with another commands for example cd %home%. For more information about using environment variables see also using environment variables.

Notes:

- The environment variables set in DOS will be copied to WinCmd if the option Pass DOS environment is active.

- Unlike DOS, there is no limit for environment variables except the available memory for WinCmd. When you exit WinCmd, all variables set will be deleted. Variables that you think you need every time you use WinCmd, should be set in AUTOEXEC.CMD to be load every time you use WinCmd.

- If you start a program from WinCmd, it will become a copy of the environment set in DOS and not that what you change in WinCmd. If you mean you need some other variables to use with other programs, please set these variables in you autoexec.bat, to load when you start the system.

- Variables that you do not need any more should be deleted to save you system resources.


GET

GET is used to get the value of an environment variable, mostly used in cmd files but you use this command also at he command line. Get will display a dialog field in which you can put your input.

Syntax:

GET  <variable name[=initial value]> [prompt] [title]

Arguments:

variable name	The name of the environment variable in which the value would be saved.

initial value	default initial value of this variable. This value will be displayed at the input field, so that you can accept it, change it or delete it and put a new value. This argument is optional, if you omit this it an empty dialog box will be displayed. If you use any separator as a part of this argument, you should quote it (see example"

prompt	The message that displayed at the button of the main window of WinCmd, so that you know which variable should be entered. This argument should be quoted.

title	The title of the dialog box. This argument should be quoted.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

get x "Enter the value of x" "Input X"	displays a dialog box to get the value of x. The Title of the dialog box will set to "Input X" and the message "Enter the value of x" will be displayed in the status line.

get destdir=c:\temp "Enter the destination directory" "Destination directory"

display a dialog box to get the value of  destdir  . The initial value displayed at the input field is c:\temp. Title of the dialog box is "Home directory" and the input message is "Enter the destination directory"

get "lib=c:\prog\include;c:\tc\h" "Enter the lib directories" "Lib path"

display a dialog box to get the value of lib.

Notes:

- There is no similar command in DOS.

- If you click the Ok button after you entered the value of the variable, the command get returns 1 and set the environment variable to this value. If you click Cancel the command returns 0 and it and do not set the variable, even if you entered a value. You can check the clicked button by checking the return value via errorlevel.

- All the argument should be quoted to prevent problems by parsing the command

- If you want to get a value from a list of possible values you can also use listbox.

- If you want to get a value from file list or directory list you can also use getfile.

- If you want to get an answer "yes or no", you can use msgbox.


GETFILE

GETFILE is used to choose a file from a dialog box (similar to open file dialog box).

Syntax:

GETFILE  <variable name> <extension mask> [title]

Arguments:

variable name	An environment variable to save the choosen file.

extension mask	 mask to define which file groups should be displayed. This argument should be quoted and has the following format:

Text1 | file type1 | text2 | file type2 ....

Text1, text2, ...	The text that displayed in the file type box. While the dialog is open you can choose one of these texts.

file type1, file type2,...	The type(s) of the files that should be displayed. You may also use wild cards.

title	The title of the getfile dialog box. This argument is optional and can be omitted. This argument should be quoted.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

getfile fname  "Text files (*.txt) | *.txt | Bitmap files (*.bmp,*.dib) | *.bmp;*.dib"  "Open file"

Display an open file dialog box. In the file type menu, there would be three items  Text files (*.txt)  ,  Bitmap files (*.bmp,*.dib)  and  the default  All files (*.*).  Choosing an item from this list, will change the displayed files to the file type(s) associated  (*.txt  , *.bmp and *.dib  or  *.*)  . The last argument is the title of the dialog box.

The path of the file you choose will be saved in the variable  fname, if you click  Ok afterwards, otherwise will not be set if you choose cancel. While the dialog box displayed you can also choose another directory or put your file mask.

Notes:

- If you want that the default file type  *.*  will not be displayed in the file type list, put a  |  at the end of the list. For example:

getfile  filename  "Executable files | *.com;*.exe;*.bat;*.cmd|" "Run"

- The command  getfile returns 1 if you choose a file, and clicked Ok. In this case the name of the chosen file will save in  filename. If you choose Cancel, it returns 0. You can check via errorlevelthe return value of this command to see if Ok clicked or Cancel.

Example:

rem run.cmd

getfile filename "Executable files (*.exe,*.com,*.cmd,*.bat) | *.exe;*.com;*.cmd;*.bat|" "Run"

if errorlevel 0 echo "Error running : canceled by user";exit

%filename%

- Every file type may be one or more file type (see example). If you put more than one file type together, you should use   ;  to separate the file types  for example  *.exe;*.com;*.cmd;*.bat  .

- If you change the directory in the dialog box, the current directory of WinCmd will also be changed to that directory.


LISTBOX

LISTBOX is used to display a list of text lines in a list box, so that you can choose on of them or put a new text.

Syntax:

LISTBOX  <variable name>  <list file> [prompt]

Arguments:

variable name	The name of the environment variable to save the chosen text.

list file	The name of the file, in which the text lines saved.

prompt	The message that displayed in the status line of WinCmd, so that you know what to do or which variable should be entered. This argument should be quoted. This argument optional and you may omit it.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

listbox ff  list.lst "Choose a file from this list"	display the file  list.lst  in a list box. The chosen file will then be saved in the variable ff. You may write this file yourself or use the command dir to write this list for example:  dir *.txt /b /f > list.lst

Notes:

- The command listbox returns 1 if you choose a line from the list and clicked Ok otherwise returns 0. This can be checked via errorlevelID_IF to see if Ok or Cancel clicked (see example).

- Use  >  to redirect the output of commands to a file, which you can use with listbox.

- You can use this command to display any text file. The text line should not exceed 128 character.

rem wincd.cmd

set f=\temp\dirlist.lst

dir /d > %f%

listbox dirname %f% "Choose a directory"

if errorlevel 0 exit

cd %dirname%

rem clean

del %f%

set f=

set dirname=


ALIAS

ALIAS is used to set, delete or display an alias name. Alias is a character string that used to substitute another character string. You can use alias to manipulate internal commands, programs or arguments. Alias is comparable to DOSKEY© macros.

Syntax:

ALIAS [name=[substitution]]

Arguments:

name	A character string that defines the name of the alias.

substitution	A character string that defines the substitution of the alias name.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

alias "dw=dir /w"	put define  dw  as a substitution of   dir /w . Every time you type dw at the command line, it will be substitute from WinCmd to   dir /w .

alias dw=	delete the last defined alias, afterwards you can not use  dw  any more.

alias edit=notepad.exe	to set  edit  to  notepad.exe, so that you may use edit to start notepad.exe .

alias	show a list of aliases.

Notes:

- Alias names have the highest

- If you use any terminator (space , comma, or semi colon) you have to quote the alias argument (see example above).

- Alias names that you define, can before you exit WinCmd. To do that, you have to mark the option Write alias back to ALIAS.INI .

- You can load the saved alias when you start WinCmd by marking the Option Load Aliases from ALIAS.INI .

- You may edit ALIAS.INI file yourself. Every line in ALIAS.INI consists of one alias name and has the same format as the command except that you do not need to write the command itself. for Example:

dw=dir /w

db=dir /b

alias edit=notepad.exe

- Aliases will only substitute commands but not arguments. For example

alias b=/b

dir b

will not works because the alias name  b  is used as an argument. In such cases you may set the alias to command + argument like this: For example

alias "dw=dir /w"

this time it will works.

- Some internal commands are external commands in DOS for example print and attrib. Thus you will not be able to run one of these DOS commands. For example if you want to use the DOS external command  print instead of the internal command print, use an alias for print:

alias print=print.exe

Now every time you use the command print, the DOS external command print will be run. Use

alias print=

to delete this alias so that you can use the internal command print again.

- It is also possible to use alias to start a program when you type the name of another program. For example:

alias edit=notpad.exe

Every time you type edit, the windows© ASCII editor notepad will be run instead of the DOS program edit.com .


PRINT

Print is used to print a document file or an ASCII file (text file). With print you will be able to print any kind of registered (associated) document. If you try to print a not associated file, print will check if it is an ASCII file (text file). If it is one, It will be print it (if the option Print not associated ASCII files as NOTEPAD document marked), if not print will not be able to print it. For more information about registration see the help information about association in file manager (winfile.exe).

Syntax:

PRINT  <file1> [file2] ...

Arguments:

file1, file2,...	The names of the files to print. You can not wild cards with this command.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

print mydoc.doc mybmp.bmp x.txt	print the file mydoc.doc, mybmp.bmp and x.txt .

Doc files are associated with Word© (if you do not have Word, the doc files will be not associated with any program). Bmp files are associated with paint brush and txt files are associated with notepad.

print autoexec.bat config.sys	print the files autoexec.bat and config.sys as ASCII files.

print readme.txt	print the file readme.txt

print mywri.wri	print the file mywri.wri (associated with Microsoft® write© ).

Notes:

- Unlike the DOS print you can print all kinds of registered files.

- The command print will starts the server program as an icon. During printing you can work with WinCmd or any other program except the server program itself. For example if you print a write document, you will be able to work with all programs except write until it ends printing.

- Using print will save your time. If you want for example to print a document, you would start the server program, load the document and then print it. Using print will make it all in one step.


Using environment variables

Environment variables are a way to transfer character strings from one program to another. They help saving time by coping often used character strings to other smaller strings. You can set every thing in a variable. For example you may set you home directory (the directory you need often).

set home=c:\programs\c\windows\prog1

Then you can use this directory in other commands like this:

copy %home%\*.* a:

or

cd %home%

Unlike DOS, the memory that used to save the environment is not limited. Thus you can use any number of environment variables.

An environment variable can be any character string and should not exceed 128 character. If you want to save more than 128 character you may use more than one variable. For example:

set dir1=c:\programs\c\windows

set dir2=\prog1

You can then use these variables like this:

cd %dir1%%dir2%

You can also use the variables to set another variable. For example:

set dir1=c:\programs\c

set dir2=prog1

set home=%dir1%\windows\%dir2%\res

Which means:

set home=c:\prog\c\windows\prog1\res

There is only one limit by using environment variables. If you start a program within WinCmd it becomes the environment of DOS (only the variables that defined in DOS and not these that defined in WinCmd). If you have such programs you may set the environment variables they need in DOS. This limitation is because the environment of WinCmd is not limited while DOS environment is limited.

Notes:

- When you start WinCmd you may transfer the DOS environment to WinCmd if you mark the Option Pass DOS environment . If this option not marked, the DOS environment will not be transferred.

- Environment variables that you often need can be written in AUTOEXEC.CMD , so that they will be loaded automatically every time when you start WinCmd. In this case you have to mark option Load AUTOEXEC.CMD when found

- Some commands will set environment variables such as listbox, get, ...


Batch commands

IF

FOR

GOTO

REM

TEST

EXIT

%0 ... %9


IF

IF is used to check a certain expression and according to the result to run or do something it its argument is true.

Syntax:

IF [NOT] <ERRORLEVEL> <value> <command>

Arguments:

NOT	turns the result of the checking if it is used (optional).

ERRORLEVEL	tests if the return value of the last command equals the value or not. If NOT used it tests if the result of the last command not equals the value.

value	the value to compare with the return value of the last command.

command	command(s) to run if the expression is true.

Syntax:

IF [NOT] <EXIST> <directory | file> <command>

Arguments:

NOT	turn the result of the checking (optional).

EXIST	test if a file or directory exists.

directory|file	the name of the file or directory to check its existence.

command	command(s) to run if the expression is true.

Syntax:

IF [NOT] <String1==string2> <command>

Arguments:

NOT	turn the result of the checking (optional).

String1 and String2	two strings to compare.

command	command(s) to run if the expression is true.

Syntax:

IF [NOT] <ARGS> <value> <command>

Arguments:

NOT	turn the result of the checking (optional).

ARGS	check if the number of arguments of a cmd file or batch file equals the value. This option can not be used in the command line.

value 	the number of arguments to check.

command	command(s) to run if the expression is true.

Standard options:

non

WinCmd options:

non

Examples:

Example 1:

rem md1.cmd

if not args 2 echo "Usage : %0 <directory name>";exit

if exist %1 echo "Error : File or directory of the same name exists";exit

mkdir %1

This cmd file (md1.cmd) tests first if the number of arguments is 2 (the name of the cmd file will be also be count) and the name of the directory to make. If it is true (the number of argument not 2), it displays the message  "Usage : %0 <directory name" and exits. %0 represents the name of the cmd file itself.

The third command checks if a file or directory of the same name exists, in this case it is not possible to make the directory. If this is true, it displays  the message "Error : File or directory of the same name exists" and exits. The 4. line makes the directory. I

If you like to use this version of  "make directory" and you want to use it, you may set an alias to link the internal command to this cmd file:

alias md=md1.cmd

Please note that, you can not use the command  md   instead of  mkdir %1 if you want to link the command  md  to md1.cmd. This would mean that md1.cmd would call itself in a loop.

Example 2:

rem dm.cmd

if not args 2 echo "Usage : %0 <file(s) or directory>";exit

test %1 /d

if errorlevel 1 goto NotDirectory

msgbox "Do you want to delete the contents of the directory : %1" yesno question

if not errorlevel 1 exit

goto delete

:NotDirectory

if not %1==*.* goto delete

msgbox "Do you want delete *.*" yesno question

if not errorlevel 1 exit

:delete

del %1

In example 2, I try to simulate exactly what would happen if you try do delete the contents of a directory (using the directory name or *.*) . The command   test  with the option  /d  checks if  %1  is a directory and returns 0 if it is one, otherwise 1. This will be checked via errorlevel. The command if after  msgbox is used to check what you have clicked (it returns 1 if you click Ok or Yes. The command if in this Form:

if not %1==*.*  goto delete

Compare two character strings  %1  and  *.*  . If they are not identical (true) the command goto delete will takes place.

Notes:

- IF is used mostly in batch files or cmd files, but you can also use it at the command line. In this case you can not use ARGS.

- You can put more than one command to run after if. In this case if the if expression true, all these commands will be executed otherwise non of them.


FOR

FOR is used to repeat one or more commands for a list of arguments (mostly files or directories).

Syntax:

FOR  <variable> IN <list> DO command(s)

Arguments:

variable	The name of an environment variable used to save one of argument of the list.

list	a list of arguments (files, directories, or strings). This list must be quoted.

command(s)	command or more, that executed for every argument in the list.

Standard options:

non

WinCmd options:

non

Examples:

Command	To

for var in "*.txt *.doc *" do type %var% /f	type all he files that have the extension txt or doc in the current directory.

for fname in "*.*" do echo %fname%	type the names of the files in the current directory in one column (the same output as dir /b).

Notes:

- The command for can be used in cmd or batch files and at the command line.

- The argument list can be any list of files or directories. Wild cards can be used.

- In most of the cases you do not need the command  for  in WinCmd, because many internal commands accept more that one argument and wild cards.


GOTO

GOTO is used to jump to certain position in a batch or cmd file. It can not be used at the command line.

Syntax:

GOTO mark

..

..

:mark

..

Arguments:

mark	The name of the mark where to jump to.

:mark	The position where to go to. It begins with colon  :  . It can be any character string up to 24 character and should not contain any punctuation character (like . ; , : + * ...) .  This mark can be before or after the goto command.

Standard options:

non

WinCmd options:

non

Examples:

rem dm.cmd

if not args 2 echo "Usage : %0 <file(s) or directory>";exit

test %1 /d

if errorlevel 1 goto NotDirectory

msgbox "Do you want to delete the contents of the directory : %1" yesno question

if not errorlevel 1 exit

goto delete

:NotDirectory

if not %1==*.* goto delete

msgbox "Do you want delete *.*" yesno question

if not errorlevel 1 exit

:delete

del %1

Notes:

- The command goto is used mostly with if, so that if a certain condition takes place, a jump will happen otherwise something else. See example above.

- The jump mark can before or after the command goto.

- The jump mark must begin with colon : .

- The jump mark must exist otherwise, an error will be displayed and the execution of the cmd or batch file will stooped.

- You may use exit to exits a cmd file, instead of using a mark at the end of the file to go to if nothing to do any more. See example above.


REM

REM is used only in batch files or cmd files to mark a line as a remark. You may use rem every where to comment, what some command does for example.

Syntax:

REM text

Arguments:

text	the comment text, it can be any thing.

Standard options:

non

WinCmd options:

non

Examples:

rem  rem.cmd . A cmd file to .......

rem this is a comment

dir ; rem list the contents of the current directory

dir /w ; rem list the contents of the current directory in wide format (only file names).

....

....

Notes:

- The command rem can only be used in cmd files or batch files.

- You can use rem any where. The rest of the line will not be processed.

- If you write a command and a comment in one line, you should separate them with semicolon  ; .


TEST

TEST is used to test a file or a directory exists. Unlike if exist , test can check if it is a file or a directory while  if exist  checks only if a file or a directory of this name exists.

Syntax:

TEST <file name |directory name> </f | /d | /a>

Arguments:

file name | directory name 	The name of the file or directory you want to check.

Standard options:

non

WinCmd options:

/f	Check if it a file and not a directory.

/d	Check it is a directory and not a file.

/a	Check if it is an ascii file (text file).

Examples:

See the example below.

Notes:

- TEST do nothing. It checks a file or a directory and saves a return value of 0 if the file or directory exists otherwise 1. If you use the option  /a  , it returns 0 if it is an ascii file (text file) . If it is not one (exe file , com file or document file) it returns 1. You may use test in cmd file or at the command line. Using test at the command line is not reasonable because you have to check the errorlevel via if afterwards to see the result.

- The command test you can check exactly if it is a file or a directory, while if exist  checks the existence of a file or directory. This may be helpful in some cases. For example:

rem save1.cmd

if not exist c:\save md c:\save

copy *.* c:\save

This cmd file will not work correctly if a file named  c:\save exists.

rem save2.cmd

test c:\save /f

if errorlevel 0 echo "A file named c:\save exists, can not make a directory";exit

test c:\save /d

if not errorlevel 0 md c:\save

copy *.* c:\save

You can see that this version save2.cmd works better.

rem typascii.cmd

rem an example of using the option  /a

if not args 2 echo "Usage : %0 <file name>";exit

test %1 /a

if errorlevel 1 echo "%1 is not an ascii file or not exists";exit

type %1


%0 ... %9

%0 , %1 ,%2 , .... , %9  are the arguments (parameters) in the command line, when a cmd file or batch file is called. For example if you have a file   x.cmd and you call it like this:

x  file1   file2

%0 would become   x   (actually the full path of the file)

%1 would become  file1

%2 would become  file2

You may use up to 10 parameter (%0 to %9). You can use If to check if the number of arguments is correct or to check the value of any of these arguments. For more information about using pararmteres in cmd files or batch files, see the examples in the cmd direcory or your DOS manual.


Command line syntax

The command line syntax is very similar to that of DOS but there some differences that I explain here.

- Command, arguments and options must be separated by blank. Unlike DOS, separators must be used always. For example DOS will handle   cd\  as   cd  \  . In WinCmd you have to use a blank between the command and the argument.

- Texts that must be handled as one argument for example with echo must be quoted.

echo Hello Welt

will not work correctly in WinCmd but:

echo "Hello Welt"

will work.

- Some commands that handle with semicolon ; as a separator must be also quoted. for example  set for example:

set path=c:\dos;c:\windows

will not work correctly in WinCmd. This because the command separator is also semicolon (I use semicolon as a command separator because it is the common command separator in other operating systems). But:

set "path=c:\dos;c:\windows"

will work correctly.

- There is no difference between upper case and lower case. Thus you may write your command in upper case, in lower case or even mixed. Only the part of the command that quoted will remain as it is.

- You can write more than one command in a line. Commands must be then separated with semicolon  ; . For example:

md tmp ; copy *.* tmp ; echo "Done!!" ; rem three commands in one line!!!


EXIT

EXIT is used to break the execution of a cmd file and ends it. EXIT will do nothing if you use it at the command line.

Syntax:

EXIT

Arguments:

non

Standard options:

non

WinCmd options:

non

Examples:

See if .


Repeating the command line

WinCmd have an internal mechanism to repeat the commands. It saves the last 20 commands. It works like DOSKEY© . The up arrow key will rewrite the last command at the prompt, where you can change it if necessary.. Successive pressing the up arrow will show the saved commands at the prompt. To go forward in the list press the down arrow.


Drag and Drop

You can use the file manager together with the file manager. The name of the files that dragged from the file manager and dropped in WinCmd will be written at the command line as they are. They will be also separated by blanks. For example to print a few files: Type first the command print and a blank and then activate the file manager, mark the files you want to print, drag then to WinCmd and drop then there. The names of the dropped files will then be written beside the command you wrote before and you may improve any thing or press return to execute the command. To be able to drop files to WinCmd you have to mark the option Accept dropped files as a part of command


Running external commands

The following file types can be run from WinCmd:

- Windows programs (EXE files).

- DOS programs (EXE files or COM files).

- DOS batch files (BAT files).

- Cmd files (CMD files).

- Registered documents (documents associated with programs).

You may run a program by typing its name with or without extension (EXE, COM, BAT or CMD). If you want to run a document you must type the extension as well.

If the name of the executable file (exe, com, bat and cmd) does not contain the path, WinCmd searches the directories in this order:

- The current directory.

- The windows directory.

- The windows system directory.

- The WinCmd directory (the directory containing wincmd.exe).

- The directories listed in the PATH environment variable.

If the name of the executable file does not contain the extension, WinCmd will search in this order:

- EXE files.

- COM files.

- CMD files.

- BAT files.

This order can be changed, or one of these types can be omitted by changing the value of ExeExt in the Settings section of CMD.INI (normally in windows directory). For example:

[Settings]

WindowPos=0,1,-1,-1,-4,-4,80,55,796,603

charWidth=9

charHeight=16

fontfaceName=Courier

textColor=16711680

ExeExt=.EXE,.CMD,.COM,.BAT

Will search EXE files and then CMD files and then COM files and then BAT files. If you change this line to:

ExeExt=.EXE,.CMD

Then only EXE files and then CMD files will be searched. COM files and BAT files will not be searched.

See also:

Loading a document file


Loading a document file
Loading a document files

You may also loading a document file in its server by typing only the name of the document (with extension). You do not need to know which program has to be load to work with this document. For example if you want for example to read a file named  readme.wri, you write :

readme.wri

WinCmd will try to check if this file associated with a program, and it runs this program and loads the file. Please note that, this will works only if the option Start the server program when tries to start document marked.


Copyright

WinCmd Version 1.4

Copyright ©  1994 Mohamed Agamia

This is an unlicensed evaluation copy of WinCmd. You may test it. If you decide to keep it, please send $30,- (DM 40,- inside Germany) to:

Mohamed Agamia

Schwestergasee 7

84034 Landshut

Germany

For comments or suggestions feel free to write or send a CompuServe E-Mail at [100330,2402].

Registered users will receive the last version of WinCmd. To print the order form please click the button  "Print order  form"  from the menu Help/About... . Thanks for trying WinCmd.

Microsoft ®  is a registered trademark Windows © , Works ©  Word © , WinWord ©  Paint brush © , Write © , Notepad © , File manager ©  and Program manager © are trademarks of Microsoft Corporation.

PCTools © and wmundel ©  are trademarks of Central point Software Inc.